Repository navigation
fix(sync): send an upper-case http(s) scheme through the egress proxy - #905
Conversation
The pull and push lanes started the egress proxy only for a URL that
began with a lower-case `http://` or `https://`. A link stored with an
upper-case scheme (`HTTPS://`, `Https://`) skipped the proxy. Today git
refuses such a link before any dial, because GIT_ALLOW_PROTOCOL compares
transport names case-sensitively ("transport 'HTTPS' not allowed"), but
the egress guard should not depend on that.
viaEgressProxy matches the scheme case-insensitively, as RFC 3986 and
curl read it, and both lanes use it. The new tests emulate a git that
takes the transport (HTTP in GIT_ALLOW_PROTOCOL, git-remote-HTTP on
PATH): on main both lanes dial the loopback upstream directly; now the
strict policy refuses it in the proxy.
Signed-off-by: Thomas Kosiewski <tk@coder.com>
---
_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_
Change-Id: I8b9f6c8ebc7db122c3b4a82e18a3024b11049cd3
Signed-off-by: Thomas Kosiewski <tk@coder.com>
worker.go and worker_push.go are covered code: both lanes now decide on the egress proxy with viaEgressProxy. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I73f2e3e60cd0db8ed443b9ddb01710e8aedc6300 Signed-off-by: Thomas Kosiewski <tk@coder.com>
|
@codex review |
|
@codex security review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Main gained #905 (both sync lanes decide on the egress proxy with viaEgressProxy). The only conflict is the sync commit of the lane-schedule model; the next commit re-records it on the merged tree. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I5ea59ebc10ff4e97ca9afa654c28d07ddf66d87d Signed-off-by: Thomas Kosiewski <tk@coder.com>
The merge brought #905's worker.go and worker_push.go fingerprints; TLC passes on the merged tree, so the sync commit moves to it. No fingerprint changes. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: If8b8572d273d3071d1ccc2f0470d5881b0066b2d Signed-off-by: Thomas Kosiewski <tk@coder.com>
Main gained #905 (both sync lanes decide on the egress proxy with viaEgressProxy). The only conflict is the sync commit of the lane-schedule model; it is re-recorded on the merged tree. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I592ce6e29585d166e4b341c338bb234bdc0d0255 Signed-off-by: Thomas Kosiewski <tk@coder.com>
With the run's host check, #905's lane tests no longer reach the egress proxy: the run refuses an `HTTP://` host before git starts. The tests still pass only while one of the two guards holds, so they now say so in their names and comments. TestViaEgressProxy pins the proxy decision by itself. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I9b3211586de1bf4cb092471eb629f0e63e886072 Signed-off-by: Thomas Kosiewski <tk@coder.com>
The merges brought #905's and #906's fingerprints; TLC passes on the merged tree, so the sync commit moves to it. No fingerprint changes. Signed-off-by: Thomas Kosiewski <tk@coder.com> --- _Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-opus-5-5` • Thinking: `xhigh`_ Change-Id: I1e93add5a92183dda736b91f90b89090e7e46ff4 Signed-off-by: Thomas Kosiewski <tk@coder.com>
The pull and push lanes started the sync egress proxy only for an upstream URL that began with a lower-case
http://orhttps://. A link stored with any other letter case (HTTPS://,Https://,HTTP://) skipped the proxy, so the guard that refuses private and metadata destinations never saw its dial.No link with an upper-case scheme gets past the guard today. The worker pins
GIT_ALLOW_PROTOCOL=http:https, and git compares transport names case-sensitively, so it refuses such a link before any dial (fatal: transport 'HTTPS' not allowed, git 2.55.0, fetch and push). This PR removes the guard's dependence on that.POST /reposrefuses an upper-case scheme since #903, so only a link stored before that can hold one.Changes
viaEgressProxy(url)(internal/sync/egress.go): true when the scheme ishttporhttpsin any letter case. URL schemes are case-insensitive (RFC 3986), and curl dialsHTTPS://as https. The pull lane (transfer) and the push lane use it in place of the two lower-case prefix checks.Evidence
TestViaEgressProxycovers mixed letter cases and the schemes that need no proxy (file,ssh,httpx,xhttps,ext::).TestWorkerUpperCaseSchemeUpstreamDialsThroughProxyandTestPushRunUpperCaseSchemeUpstreamDialsThroughProxystoreHTTP://127.0.0.1:<port>under the strict egress policy. They emulate a git that takes the transport:HTTPinGIT_ALLOW_PROTOCOL, and agit-remote-HTTPonPATHthat is the realgit-remote-http, as a case-insensitive file system would find it. Both expectrepository configuration errorand no request at the upstream.the HTTP:// upstream was dialed around the egress proxy). Without the emulation they fail too (failed to clone repositoryandfailed to push to upstream: git refused the transport), so only the proxy's refusal passes them. Mutants: main's prefix check inside the helper (three tests fail), and a lower-casedhttpprefix check (the table fails onhttpx://).go test -race -tags=openstorage_viewcheck ./internal/sync/...passes at 9c7da84 (90 s). lint, vet (linux and darwin), gofmt, the docs gate and both fingerprint gates pass.Reviews
HTTP://,HTTPS://,Https://andhTtP://on fetch and push with no request at the upstream, andprotocol.allowsettings do not overrideGIT_ALLOW_PROTOCOL. The three upstream dials (the fetch, the default-branchls-remoteand the push) all use the proxied environment. Its mutants (each lane alone reverted,httpsonly, main's prefix check) all failed the tests. Left open (P3):http::<url>form passesGIT_ALLOW_PROTOCOLand skips the proxy (viaEgressProxyreads its scheme ashttp::http). No stored link can hold it:POST /reposhas refused it since before v0.1.0, and the follow-up that checks each stored host at run time refuses it too.strings.EqualFoldfolds Unicode, sohttpſ://also starts the proxy; git refuses that protocol, so this is harmless.HTTP://only. The review probed theHTTPS://path (CONNECT): the emulated git used the proxy, becauseproxyEnvsets every proxy variable.internal/sync/README.mdcould say that the proxy starts per http(s) transfer.Found by the reviews of #903 (desk follow-up).
Generated with
xum• Model:anthropic:claude-opus-5-5• Thinking:xhigh